import { DomSanitizer } from '@angular/platform-browser';
import { Pipe, PipeTransform } from '@angular/core';



/**
 * Bypass security and trust the given value to be a safe resource URL, i.e. a location that may be used to load executable code from,
 * like <script src>, or <iframe src>.
 * WARNING: calling this method with untrusted user data exposes your application to XSS security risks!
 */
@Pipe({
    name: 'trustResourceUrl'
})
export class TrustResourceUrlPipe implements PipeTransform {

    constructor(private domSanitizer: DomSanitizer) { }

    transform(value: any, args?: any): any {
        return this.domSanitizer.bypassSecurityTrustResourceUrl(value);
    }

}
